home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_11
/
9n11062a
< prev
next >
Wrap
Text File
|
1991-03-02
|
2KB
|
133 lines
/*
* xaw1.c
* Athena Widget test Program
* using Athena Widgets
*
* NOTE: If you are compiling under Release 4
* of X, be sure to define X11R4.
*
* Written for C Users Journal
*
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
/*
* Comment out if you are running
* on a system earlier than
* Release 4
*/
#define X11R4
/*
* Release 4 has Athena include
* files in new places.
*/
#ifdef X11R4
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Label.h>
#else /* older than Release 4 */
#include <X11/Command.h>
#include <X11/Paned.h>
#include <X11/Label.h>
#endif
/* ARGSUSED */
void quit_callback( widget, client_data, call_data )
Widget widget;
caddr_t client_data;
caddr_t call_data;
/*
* Callback function to quit program.
* We could close the connection to
* the X server here, or just call exit().
*/
{ /* quit_callback */
exit( 0 );
} /* quit_callback */
main( argc, argv )
int argc;
char *argv[];
{ /* main */
Widget parent;
Arg args[20];
int n;
Widget pane_widget, quit_widget;
Widget label_widget;
/*
* Set up top-level shell widget
*/
parent = XtInitialize( argv[0],
"Xaw1", NULL,
0, &argc, argv );
/*
* Set up pane to control whole application
*/
n = 0;
pane_widget = XtCreateManagedWidget( "pane",
panedWidgetClass,
parent, args, n );
/*
* Set up command widget to
* act as a push button
*/
n = 0;
quit_widget = XtCreateManagedWidget( "quit",
commandWidgetClass,
pane_widget, args, n );
/*
* Set up a callback function
* to be called whenever
* the command push button is
* "activated".
*/
XtAddCallback( quit_widget, XtNcallback,
quit_callback, (caddr_t) NULL );
/*
* Set up label widget
*/
n = 0;
XtSetArg( args[n], XtNlabel, "This is a label." ); n++;
label_widget = XtCreateManagedWidget( "label",
labelWidgetClass,
pane_widget, args, n );
/*
* Map widgets and handle events
*/
XtRealizeWidget( parent );
XtMainLoop();
} /* main */
/*
* end of file
*/